{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 准备工作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "阿里研究院\n",
    "阿里健康\n",
    "阿里巴巴商学院\n",
    "阿里数据\n",
    "\n",
    "腾讯金融科技\n",
    "腾讯研究院\n",
    "腾讯媒体研究院\n",
    "腾讯云启研究院\n",
    "酷鹅用户研究院\n",
    "'''\n",
    "公众号 = \"蚂蚁金服科技\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "fn = { \"output\" : { \"公众号_htm_snippets\": \"data_raw_src/公众号_htm_snippets_{公众号}.tsv\",\n",
    "                    \"公众号_df\": \"data_raw_src/公众号_df_{公众号}.tsv\",\n",
    "                    \"公众号_xlsx\": \"data_sets/公众号_url_{公众号}.xlsx\" } \\\n",
    "      }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 采集公众号（requests）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "5\n",
      "10\n",
      "15\n",
      "20\n"
     ]
    },
    {
     "ename": "NameError",
     "evalue": "name 'ExcelWriter' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-7-496c388f9d1d>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m     51\u001b[0m \u001b[0mtest\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mcontent_list\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     52\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 53\u001b[1;33m \u001b[1;32mwith\u001b[0m \u001b[0mExcelWriter\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfn\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"output\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"公众号_xlsx\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m公众号\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"蚂蚁金服科技_requests\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mwriter\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     54\u001b[0m     \u001b[0mtest\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mto_excel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mwriter\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     55\u001b[0m \u001b[1;31m# test.to_csv(\"../微信公众号爬虫_zhichao/南方周末.csv\",mode='a',encoding='utf-8')\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNameError\u001b[0m: name 'ExcelWriter' is not defined"
     ]
    }
   ],
   "source": [
    "# 目标url\n",
    "\n",
    "import time\n",
    "import requests\n",
    "import pandas as pd\n",
    "import csv\n",
    "\n",
    "\n",
    "url = \"https://mp.weixin.qq.com/cgi-bin/appmsg\"\n",
    "\n",
    "# 使用Cookie，跳过登陆操作\n",
    "headers = {\n",
    "  \"Cookie\": \"pgv_pvi=7968112640; RK=dAxoOkmNPM; ptcz=5e911a8738788675abb010f85db7a6c13b0570811db08ebefce3d01adfff5127; tvfe_boss_uuid=35a8107e1f02cbf7; pgv_pvid=160875890; o_cookie=576726974; pgv_si=s7389809664; uin=o0576726974; skey=@biD9HkZPV; ptisp=ctc; ua_id=o954FR4YG9aIylgbAAAAAAG1mFSkee-v8r6HcCv6PUM=; cert=xdo33QVRQxDDEATQOxVPYZVSl8hcgbBw; noticeLoginFlag=1; xid=; openid2ticket_omd36wPk8CgeWUiAccw6ZoK6cfKM=V9b+6gaDppAhuzkBsqQ2cqmVOoVbPExAl/fu+rqQ2xk=; mm_lang=zh_CN; rewardsn=; wxtokenkey=777; uuid=3f563116b647ce9a578c8d004d3508a8; ticket=a4fe0acfed322dd3eff3a301d94afded6dac3be0; ticket_id=gh_b8ce1853cd9b; rand_info=CAESIIpFhkwqorHCev9Vkx8d1xoS/h28VHdI65d1I+hS8rYh; slave_bizuin=3252904960; data_bizuin=3509374721; bizuin=3252904960; data_ticket=6z/ln+jO+jKPoA5MKzm3D6Cbfkg41cD9D6v6HTaHq8//2C9Hk73W6LtQlNMXteTT; slave_sid=eWpTNFJYU0hHQUFtcUt1TnBGSEZDYU55bHJXX2hhTTlZa3hvcno4MFRNaGd2QUlIT2Vxb0xHUmRWc1RQV2txQkI3OXFlUXhuOWY1aGVYbWdvTGFpNzNhTTdNaGhaRWNWNmwzTmFMRWlEa25Pa0VkZGpwVGkxNTRUdmRTbEtpbGF2UFUwbEZJR0lHdnlBcDFs; slave_user=gh_b8ce1853cd9b; openid2ticket_oAc8s0T6rPCr8qnMO7SoANf_3jVI=LJrk/Pum+BnDCZRPacwc+RgFKJv/+2uJEUtvOa1gdTU=\",\n",
    "  \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36\"}\n",
    "\n",
    "data = {\n",
    "    \"token\": \"1119521086\",\n",
    "    \"lang\": \"zh_CN\",\n",
    "    \"f\": \"json\",\n",
    "    \"ajax\": \"1\",\n",
    "    \"action\": \"list_ex\",\n",
    "    \"begin\": \"0\",\n",
    "    \"count\": \"5\",\n",
    "    \"query\": \"\",\n",
    "    \"fakeid\": \"MzI0Nzc3MTQyMw==\",\n",
    "    \"type\": \"9\",\n",
    "}\n",
    "\n",
    "\n",
    "\n",
    "content_list=[]\n",
    "\n",
    "for i in range(5):\n",
    "    data[\"begin\"] = i*5\n",
    "    print(data[\"begin\"])\n",
    "    time.sleep(3)\n",
    "    # 使用get方法进行提交\n",
    "    content_json = requests.get(url, headers=headers, params=data).json()\n",
    "#     print(content_json)\n",
    "    # 返回了一个json，里面是每一页的数据\n",
    "    for item in content_json[\"app_msg_list\"]:\n",
    "    # 提取每页文章的标题及对应的url\n",
    "        items = []\n",
    "        items.append(item[\"title\"])\n",
    "        items.append(item[\"link\"])\n",
    "        items.append(item[\"create_time\"])\n",
    "        content_list.append(items)\n",
    "\n",
    "\n",
    "name=['title','link','create_time']\n",
    "test=pd.DataFrame(columns=name,data=content_list)\n",
    "with pd.ExcelWriter(fn[\"output\"][\"公众号_xlsx\"].format(公众号=\"蚂蚁金服科技_requests\")) as writer:\n",
    "    test.to_excel(writer)\n",
    "\n",
    "# test.to_csv(\"../微信公众号爬虫_zhichao/南方周末.csv\",mode='a',encoding='utf-8')\n",
    "# print(\"保存成功\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 采集公众号（selenium）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from lxml.html import fromstring\n",
    "import time\n",
    "from random import random\n",
    "\n",
    "# when selenium main_content is used\n",
    "# Parses an HTML document from a string constant.  Returns the root nood\n",
    "# root = fromstring(df.loc[1,\"html_snippets\"]) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用Selenium\n",
    "* 要更改 opts.binary_location 至自己本地的Chrome浏览器，建议portable\n",
    "* Chrome浏览器 和 chromedriver.exe要同版本号到小数后一位\n",
    "* 要确保可以 开启浏览器机器人\n",
    "* 要确保浏览器机器人 可以打开网页 driver.get(\"https://mp.weixin.qq.com\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\zhichao\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:18: DeprecationWarning: use options instead of chrome_options\n"
     ]
    }
   ],
   "source": [
    "from selenium import webdriver\n",
    "from selenium.webdriver.common.desired_capabilities import DesiredCapabilities\n",
    "\n",
    "#caps=dict()\n",
    "#caps[\"pageLoadStrategy\"] = \"none\"   # Do not wait for full page load\n",
    "\n",
    "opts = webdriver.ChromeOptions()\n",
    "opts.add_argument('--no-sandbox')#解决DevToolsActivePort文件不存在的报错\n",
    "opts.add_argument('window-size=1920x3000') #指定浏览器分辨率\n",
    "opts.add_argument('--disable-gpu') #谷歌文档提到需要加上一这个属性来规避bug\n",
    "opts.add_argument('--hide-scrollbars') #隐藏滚动条, 应对些特殊页面\n",
    "#opts.add_argument('blink-settings=imagesEnabled=false') #不加载图片, 提升速度\n",
    "#opts.add_argument('--headless') #浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败\n",
    "\n",
    "opts.binary_location = r\"C:\\Users\\zhichao\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe\" #\"H:\\_coding_\\Gitee\\InternetNewMedia\\CapstonePrj2016\\chromedriver.exe\"  \n",
    "\n",
    "# \"H:\\_coding_\\Gitee\\InternetNewMedia\\CapstonePrj2016\\chromedriver.exe\"  \n",
    "driver = webdriver.Chrome( chrome_options = opts) #desired_capabilities=caps,"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.get(\"https://mp.weixin.qq.com\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 填表登入"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "selenium 的定位方法\n",
    "* find_element_by_id &ensp;&ensp;&ensp;  根据标签id定位\n",
    "* find_element_by_name   &ensp;&ensp;&ensp; 根据标签的name定位\n",
    "* find_element_by_xpath  &ensp;&ensp;&ensp; 根据xpath定位\n",
    "* find_element_by_link_text  &ensp;&ensp;&ensp; 通过文字链接来定位元素\n",
    "* find_element_by_partial_link_text  &ensp;&ensp;&ensp;  通过文字链接来定位元素\n",
    "* find_element_by_tag_name  &ensp;&ensp;&ensp;  根据标签的名字定位\n",
    "* find_element_by_class_name  &ensp;&ensp;&ensp; 通过class name 定位\n",
    "* find_element_by_css_selector  &ensp;&ensp;&ensp;  根据元素属性来定位"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "payload =  {\"account\": \"lujiayan123@126.com\", \"password\": \"Aa86460123\"}\n",
    "# payload =  {\"account\": \"NFUHacks@163.com\", \"password\": \"NFU706947580\"}\n",
    "driver.find_element_by_xpath('//div[@class=\"login__type__container login__type__container__scan\"]/a').click()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "WebDriver 常用方法：\n",
    "* clear()清楚文本\n",
    "* send_keys(values)模拟按键输入\n",
    "* click()模拟点击\n",
    "* submit模拟提交"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.find_element_by_xpath('//form[@class=\"login_form\"]//input[@name=\"account\"]').clear()\n",
    "driver.find_element_by_xpath('//form[@class=\"login_form\"]//input[@name=\"account\"]').send_keys(payload['account'])\n",
    "driver.find_element_by_xpath('//form[@class=\"login_form\"]//input[@name=\"password\"]').clear()\n",
    "driver.find_element_by_xpath('//form[@class=\"login_form\"]//input[@name=\"password\"]').send_keys(payload['password'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.find_element_by_xpath('//div[@class=\"login_btn_panel\"]/a').click()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 点选单"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "其他常用方法\n",
    "* size：返回元素的尺寸\n",
    "* text：获取元素的文本\n",
    "* get_attribute：获取属性值  &ensp;&ensp;&ensp; get_attribute('innerHTML')获取元素内的全部HTML\n",
    "* is_displayed()：设置该元素用户是否可见"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'展开'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "element = driver.find_element_by_xpath('//a[@id=\"m_open\"]')\n",
    "element.click()\n",
    "main_content = element.get_attribute('innerHTML')\n",
    "main_content"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.execute_script(\"window.scrollTo(0,document.body.scrollHeight)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'https://mp.weixin.qq.com/cgi-bin/appmsg?begin=0&count=10&t=media/appmsg_list&type=10&action=list&token=969419833&lang=zh_CN'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "element = driver.find_element_by_xpath('//li[@title[contains(.,\"素材管理\")]]/a') \n",
    "# main_content = element.get_attribute('innerHTML')\n",
    "# main_content\n",
    "url2= element.get_attribute(\"href\")\n",
    "url2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.get(url2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 新建图文消息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "element = driver.find_element_by_xpath('//*[text()[contains(.,\"新建图文消息\")]]') \n",
    "main_content = element.get_attribute('innerHTML')\n",
    "main_content\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['CDwindow-A8238326E8352BB70BE06A6974D35341', 'CDwindow-980EB5FCF344439C4EC895C4BC55E03E', 'CDwindow-6ACCC17B14DEA446533131B33A3D2425']\n"
     ]
    }
   ],
   "source": [
    "print (driver.window_handles)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 新建图文消息开了另一分视窗，所以要切换 switch_to \n",
    "driver.switch_to.window(driver.window_handles[-1])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 超链接"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                超链接              \n"
     ]
    }
   ],
   "source": [
    "element = driver.find_element_by_xpath('//*[text()[contains(.,\"超链接\")]]') \n",
    "main_content = element.get_attribute('innerHTML')\n",
    "print(main_content)\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "选择其他公众号\n"
     ]
    }
   ],
   "source": [
    "# 点 选择其他公众号\n",
    "element = driver.find_element_by_xpath('//*[text()[contains(.,\"选择其他公众号\")]]') \n",
    "main_content = element.get_attribute('innerHTML')\n",
    "print(main_content)\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "driver.find_element_by_xpath('//form//div[@class=\"inner_link_account_area\"]//input[@class=\"weui-desktop-form__input\"]').clear()\n",
    "driver.find_element_by_xpath('//form//div[@class=\"inner_link_account_area\"]//input[@class=\"weui-desktop-form__input\"]').send_keys(公众号)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<div class=\"weui-desktop-icon weui-desktop-icon__inputSearch weui-desktop-icon__small\"><!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <!----> <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.33 10.007l4.273 4.273a.502.502 0 0 1 .005.709l-.585.584a.499.499 0 0 1-.709-.004L10.046 11.3a6.278 6.278 0 1 1 1.284-1.294zm.012-3.729a5.063 5.063 0 1 0-10.127 0 5.063 5.063 0 0 0 10.127 0z\"></path></svg> <!----> <!----> <!----> <!----></div>\n"
     ]
    }
   ],
   "source": [
    "# 点放大镜搜\n",
    "element = driver.find_element_by_xpath('//button[@class=\"weui-desktop-icon-btn weui-desktop-search__btn\"]')\n",
    "main_content = element.get_attribute('innerHTML')\n",
    "print(main_content)\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/8zGb2W5DJWvF1ibic8Ff0hib2zM1PNggypmobkam18vP1Nh7kaBU77zrJ8WD9vd8nj4uicvXIFXu1Ek0ScZGia91Clw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服科技</strong> <i class=\"inner_link_account_wechat\">微信号：Ant-Techfin</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/rS76otFH2pNlicVQBHK655aKVDMOs2fbSdQb0Zxic4ibIGJUNAayAjy3yCeWqSFe4GVNhExtpNt4opiavkicHGHI1hQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服</strong> <i class=\"inner_link_account_wechat\">微信号：mayi-jinfu</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/ibouibdiaMA9KyndRqTmA3nJJpuL3eCmHqF9L5FzIQ3aoG8fH3gZT8dT3uZyD9YYvA9dlwTsHDfEtgW9hVt5jKHkg/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">山东蚂蚁金服网络科技有限公司</strong> <i class=\"inner_link_account_wechat\">微信号：SDMYJF_FWH</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/cia3tMb8xpGJSuySfict4E8oUlkK2307gQnOiaa93h83mib5Wcp3oKp570jgcWdSBiatwvU9nT2Hgs9Qzg0tvJUU8sw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服花呗</strong> <i class=\"inner_link_account_wechat\">微信号：mayi_huabei</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/yUzZJ4Kn9SKeM7PkPzJ6jS8wPkThrvyOVQBjicHibpSl2u750orYFhBoSOdmIyickfbhCxh26Urz5mudArvImicVLw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服客户中心</strong> <i class=\"inner_link_account_wechat\">微信号：AlipayCustomerCenter</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/njNOiayhTg0vmmugt6hiaJVic45dibuWblwcsPibP9D2E8iaHbDWSW86DnhXS2faddpqicd9dKL3t0AZF6TXlzCdEys2A/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服安全响应中心</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/BjOkDkyzUic6MRBnJeJCenUcrSt7RwcjibsYE6nY6N7xkmGEQiaUzBPVetUjVZ9mxxV6PwRDxDY65Yr8aMbDfV8gw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服设计</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/lb6ia71mvjV5VTCn5K7a39dISMEQbAAhGRfgMZgpcGxEvMiaVflH6EkEibEpjibBZ0etASSoEwNMsGx8qTfV3hr0jQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁力量教育金服</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/AswAlwaiaXrahCX41MHlSbxxDSfX5V3cN6TeuKias1ZickKvNkjq8OIAlR1k0RcY57KLxsxcCmKv6AmrcGL8LPK2w/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">刷脸支付科技招商总部</strong> <i class=\"inner_link_account_wechat\">微信号：nshop8898</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/8Lib8A2FWXhRy0CwIk4LUZkbVe4MrjicTTSibqf5P6VIXCyibsFDZBVIuOHms9Kpb2ibviag1s0ibInCVZ5icsj8yqs5Ig/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服智慧网点</strong> <i class=\"inner_link_account_wechat\">微信号：Smart_Site</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/XNsW9Nqm686vUkC7Zy4QGCXHBxTIR2VAyR4gyIneDJmMKe3GAvhkdvnaEq6eM87GwoFAD6hAXr0UWuBTjcxHwA/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁科技评论</strong> <i class=\"inner_link_account_wechat\">微信号：afsreview</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/7FPxWqp3TicK7vNZDJvI4U00ib07djyKibpKztgsh7ulawdcfpmYMwYozaCCQyhFusIXzmkTdTE5KwjtcnzzD5yKA/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服传媒</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/oeNiaK0ttF18JxgIicAtMC0oGZXveP4gSTGLJY4JM7ciciaicl1HAbCQokibDcKr8LWQ5uwaficwxojZ5wgaHxCN08xqQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">竹琂网络科技商服</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/7osPK5OqdibX3awhOjFmlNTgXesg3ic5eMK42eJ0IrAx1uxbHe8AjkEPoPZhRKhC8RGZO9ojq2W7UvNeHFXGgStA/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">平江县蚂蚁部落乐园</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/QVdwVySrAMqvLjOqNjQzliaLiaBEEejXFictXdd4VFdwWFdzRGicGmhGXgp9ic6WK6ia214wFgVozMqYT1giaaf4Wckjw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">AttractPay 汇聚宝金融科技</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/33LlDh3XEam0AYZzeqicoyfXdSibBEdP8RmG1hNv6HuW17NSSM6peY9d8IdTYAys2UjOtlKXR6mZxtnlfh34lYcw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁区块链</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/c7mgEJ0RNIdbzfe2EDVCPicfiaURqkgAU79AWUPcpiaicgzTgnoXFqgRZic00Ikk3Un2RRD1wrgfniasbnEUxhJQhHLw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">湖北高沃科技有限公司</strong> <i class=\"inner_link_account_wechat\">微信号：hbgw888888</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/MqZ7ElPH8gksAnTPYMnGxfib59vrsAVJkmtDZMXx60JgC613TjiayGeuicBQZtIDJDkosiaw2ichiaBOlTHHsdfEibzwg/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">快盈科技官方服务号</strong> <i class=\"inner_link_account_wechat\">微信号：kuaiyingkeji</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/XTLeplxCIdH6zeicERD5ctmJpm58F1ZAdTPQ0oSIicGibNGlqiajj8kT9ibib5Jd5Toiba5MSZLnicfhAObYrXf9REqAog/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">稻草人网络科技</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz/DTx2JIuml7cx6TkTtKZkH5raYTQwXo78Jib457KicgicvpbibbL3t7cI1IL1xJStgeENArAyH3beQXo1NTumQUictww/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">陕西畅通网络科技有限公司</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/rZia194gnpzrXc4hnkMMib4nNAbz9uKplqfSZo2l1DCCS4cxlLY2JQibqRMxV4ibMZGibxSHlkOusroEStD5iaoiaNC2w/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">利群信息科技</strong> <i class=\"inner_link_account_wechat\">微信号：w7246314</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/LeMRN463LG2npBuLZjEzwtWVGZ85vXCHGNUHtYwVTkibWVLVBZHFtAgcMQ1yCNwhN72pAGYwIvBdR2HkV0SV8tQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">参美智创网络科技</strong> <i class=\"inner_link_account_wechat\">微信号：shenmeizhichuag</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/rib1rickJU3RqPicNwZJqDeTPZdMpx63sVDazzlqQGcZwlMmswVQBGGx5dasaZ2d3M8hhLiaibtoBLtzjS6g4oQ9FgA/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">数心网络科技</strong> <i class=\"inner_link_account_wechat\">微信号：haifen92</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/hVDY5yqv2bpSl3hydT8jqt14y0mvNZBEibibPpKFy7YSANPumWkpOaB4JoXSWSIibIGYLNRB5M1Mljb9Y0sRbMUibQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">鑫牛科技</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/Jp019cM4DCPpPT9ss8TS5oO3SibQ4iaPJMOI5Wv9U2SWyASnkQMvovzYqgicknWd2KXqPjasuwfo6CibcqEibia97PFQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">加佳科技</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/MDYxDGe7BExOVe8rJrVFUnol2XONhuBwDITjIExul5M6wP3w3okmv3rsia57xhKolicTY6TOGOqUIFhhGTMp04tQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">深圳市脸付通智能科技有限公司</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/w6hDicZaibkkYDSH3t4okDWKhuZQ4ia0apGyzUSY6oQBf72xuVOZqgOPGMKBngQBQEic4L3xcUicu1Ob8VUb5ibFmftg/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">重庆捷阳科技</strong> <i class=\"inner_link_account_wechat\">微信号：chongqingjieyangkeji</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/9NDopxujvg9tQZpPYUfRyic3VrWHNoPWDXHA2v45ibdYAvJfaBudeDwhD5gUD1arl6ibCFfwQFlo35O3I0ULiapr8Q/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服公开课</strong> <i class=\"inner_link_account_wechat\">微信号：afbs_openclass</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">青岛触角物联科技有限公司</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/uWNFVOic9YBW4FwzD3amYZr5edOiajXTU7ZmWoNw5Feia408WCKib0PImUjTIAicn6qJMuCngCICEDynHrsDf7D0bsw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">江西善金科技有限公司</strong> <i class=\"inner_link_account_wechat\">微信号：JXSJ1888</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/DLUX4bKiav4wqGGCnuRqm0ibDhXKApz00AhjhxzQYkvicfw72mu7wPdHNIJGWTU39TOxxDNjV8V3ic8anINj2RfPiag/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁cashant</strong> <i class=\"inner_link_account_wechat\">微信号：cashant</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/psqJ9K8An35AicrGcrtJ3t0rakjPoTLbKVDf71oFAPClicuE9wICUsGKd7mzRUXwQtfjqSxK6nibAA3tP3z6936Jw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">若火科技</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">中原蚂蚁金服</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/OpUK52QUXE2Aqw2QHB2SqNzNCFsicE5a5MjKuq44ziaLEic0C1p5RtytCu8ytFO3qgHDwDHlDYewJZTYic5xs5gAibQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">芭爷科技</strong> <i class=\"inner_link_account_wechat\">微信号：BYKJ-HZ</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/ycUAn3ScPG5S9Bq4Nqdf6dKgSvj2SibGp0IWrReBhdG9elpFksTJxJGklRIDc6BicwJsY967f6nYh8e9ib8B4Ticrw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">济南蚂蚁金服</strong> <i class=\"inner_link_account_wechat\">微信号：sd-bofu</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/AwbGS9iaoDMh2yyp9WpI2VBznP65szT4U7iaicicweO2Q637VESN8xgiaCNKyoM6yXOsGmMps2DLnCuCjEv7kicnI1Ig/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服义乌站</strong> <i class=\"inner_link_account_wechat\">微信号：zfb-yw</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/TIgmkU3YJL6icLhtKoHvrfWia5tNJFhBiaWghFZrfOwwmqCcFO7Nk28hhzJvFKibEVSh8dgcpm2xg7G6KftDvgwdSQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服保险服务</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/agSJlCFecwn9B2njlUQib5JMl4UkuES1lwVIxQAbZH2251dkfba14Znn1ria3lHfWIKwicW5Wqdickeyn4cKP8vU9w/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">合肥蚂蚁金服</strong> <i class=\"inner_link_account_wechat\">微信号：hfmyjf</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/7teRkrDIhtadDa7bh1GkAnB99auaOClQsicP3LS7Sln8cUY4gXiaJibiaCm8fhHV6TqZq6v9ic4jTyquLzlaBwWWwSw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁小招</strong> <i class=\"inner_link_account_wechat\">微信号：ANT-Fin-Recruitment</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/o5pOXFS9elJVBT9TjcPvMnjgGwYZt0U74K1qIBc29yX28qUo9hl32TElPKWar6HT5Er6ZKj7sZ7fU1zQ1VX3CQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服金华站</strong> <i class=\"inner_link_account_wechat\">微信号：zhifubaojh</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/I8SfHxT94hVQ1srsibwuxAvhps3mAwBoQPZ6IMCZqgHf3L5rMKQcVjWtaMqNaAyPDibrZQdicLKHpicPk6iczzvEKuQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁研发效能</strong> <i class=\"inner_link_account_wechat\">微信号：AntLinkE</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/hUCbRoxybbdKSP14cMFgZ5icR8c11BCrbleicXic6gGPx1Iek7C9nib2PvFRibvUM6G35EbpMfVAmDvL9uO9kCy9ABw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">北京金蚂蚁</strong> <i class=\"inner_link_account_wechat\">微信号：JMY_JF</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/vCicX1Y3qUn1Wz2PrwhGAYfukjFgLJyUFO5VPmq6LiafxCs6XjSjpTiat5za8iaHLTibNQedUlDU9HURjJJFiclVibF9g/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁云金服</strong> <i class=\"inner_link_account_wechat\">微信号：mayiyunjinfu</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/muD0iaY26QREQa14DBvE1j1q72XormKJ4KgjwwZXYI50mM6oUaq4uo09l19jiazBrGDRc8aNgUu1Taoibe5h1Ceiag/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">广东蚂蚁旅游</strong> <i class=\"inner_link_account_wechat\">微信号：gdmyly87563598</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/rFH9xa3hCiazRIxWiaKYrwia4UfuWDehXppwia1lwhRkAEibW9jmFm7BZ0UNeSPjIqmF5iaXlPQ6LhgppKruJQvpCMkw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">友宝一蚂蚁IT</strong> <i class=\"inner_link_account_wechat\">微信号：XJRant</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/uibgoFmWoibzOKPjN51nkpH7ULDMXOFX8RaUKpT1Vsib5jZ1tKSyQUuXn0BqfGZwELezSUicknGysnoxLjZhNOmP5A/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">安徽蚂蚁金服网络科技</strong> <i class=\"inner_link_account_wechat\">微信号：anhuimyjf</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/0YZHIqmVP7n9GmnkfEqibiaVqlbGhb9wIowVZrGuHSjlGkox7ZJ1JbdMBSZ1uLtb8fiaiapJI52Hj0nb1NvMd6y0oQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">南京蚂蚁金服</strong> <i class=\"inner_link_account_wechat\">微信号：njmyjf</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/1f115uzuPIpPc4PlibwroX6DfuTLbZrJX9hRPXZEWAX2qJbnRiauzkhwHT9oek7sYqwyqdd4TXXXlNRRicYb75sPg/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁旅游中山运营中心</strong> <i class=\"inner_link_account_wechat\">微信号：zsmyly2019</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/dHt5aagRDicTgmTxxPfNw5AuETNSRvMA4ibFYDnkEB8qG6CsqTsSyOfQfG9pSeGKicjuOQyvgppxDticAoLxr5FDug/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">大连蚂蚁金服</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">科技蚂蚁</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/YtXzEj3ZA7rXVib7rEelU9ZCjOTw6Og3utF6W2K7u0Vyr5dLMqdsykbCWbRM3uVmMhQpWkCdI4lahiaouWiaYH88g/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁好家政</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/ulbibatbfDPz4zMJo8pquZQmoFDBj5NhuKAQpyZXticfhibes5iafzppibbVYrTUoB4LQP6lMDwL460CibX5IwlpY3vw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁门户</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/b4lIQYQPAl7WHffv6Tw3uSJWMibFOKNb3p2lHuMozcyDKqYbQibIuR1kD3HfNaZakW7iaDBUsRlHpv0zKZ2CGfWsQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">芝麻信用服务号</strong> <i class=\"inner_link_account_wechat\">微信号：zhimaxy</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">服务号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/OsQS7WgMFQOect8MtdRGMldH9poLibaEicMa11dzzHfYFOCF58s7Ua0cNWkZQVicQuia8mTsCQDdXULRCfiakk70Uvw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">支付宝</strong> <i class=\"inner_link_account_wechat\">微信号：Alipayvoice</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li><li class=\"inner_link_account_item\"><div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/8pXrPXQMyiaN4JAeyaAV51zWdUldBbM8IEgib2icmxzJyJt1afNauZQDsYBeHTTzXHIulFy5fSRJkrWbdy2C52RBQ/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁达客</strong> <i class=\"inner_link_account_wechat\">微信号：未设置</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div></li>\n"
     ]
    }
   ],
   "source": [
    "element = driver.find_element_by_xpath('//ul[@class=\"inner_link_account_list\"]')\n",
    "main_content = element.get_attribute('innerHTML')\n",
    "print(main_content)\n",
    "公众号SERP = main_content\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 解析\n",
    "root = fromstring(公众号SERP) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "主 = root.xpath('//li[@class=\"inner_link_account_item\"]')\n",
    "\n",
    "account_list = []\n",
    "for e in 主:\n",
    "    account_nickname = e.xpath('./div/strong[@class=\"inner_link_account_nickname\"]')[0].text\n",
    "    account_wechat = e.xpath('./div/i[@class=\"inner_link_account_wechat\"]')[0].text\n",
    "    account_img = e.xpath('./div/img/@src')[0]\n",
    "    account = {\"nickname\": account_nickname, \"wechat\": account_wechat, \"img\": account_img,}\n",
    "    account_list.append(account)\n",
    "\n",
    "df_account = pd.DataFrame(account_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>img</th>\n",
       "      <th>nickname</th>\n",
       "      <th>wechat</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/8zGb2W5DJWvF1ib...</td>\n",
       "      <td>蚂蚁金服科技</td>\n",
       "      <td>微信号：Ant-Techfin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/rS76otFH2pNlicV...</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>微信号：mayi-jinfu</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/ibouibdiaMA9Kyn...</td>\n",
       "      <td>山东蚂蚁金服网络科技有限公司</td>\n",
       "      <td>微信号：SDMYJF_FWH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/cia3tMb8xpGJSuy...</td>\n",
       "      <td>蚂蚁金服花呗</td>\n",
       "      <td>微信号：mayi_huabei</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/yUzZJ4Kn9SKeM7P...</td>\n",
       "      <td>蚂蚁金服客户中心</td>\n",
       "      <td>微信号：AlipayCustomerCenter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/njNOiayhTg0vmmu...</td>\n",
       "      <td>蚂蚁金服安全响应中心</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/BjOkDkyzUic6MRB...</td>\n",
       "      <td>蚂蚁金服设计</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/lb6ia71mvjV5VTC...</td>\n",
       "      <td>蚂蚁力量教育金服</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/AswAlwaiaXrahCX...</td>\n",
       "      <td>刷脸支付科技招商总部</td>\n",
       "      <td>微信号：nshop8898</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/8Lib8A2FWXhRy0C...</td>\n",
       "      <td>蚂蚁金服智慧网点</td>\n",
       "      <td>微信号：Smart_Site</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/XNsW9Nqm686vUkC...</td>\n",
       "      <td>蚂蚁科技评论</td>\n",
       "      <td>微信号：afsreview</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/7FPxWqp3TicK7vN...</td>\n",
       "      <td>蚂蚁金服传媒</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/oeNiaK0ttF18Jxg...</td>\n",
       "      <td>竹琂网络科技商服</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/7osPK5OqdibX3aw...</td>\n",
       "      <td>平江县蚂蚁部落乐园</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/QVdwVySrAMqvLjO...</td>\n",
       "      <td>AttractPay 汇聚宝金融科技</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/33LlDh3XEam0AYZ...</td>\n",
       "      <td>蚂蚁区块链</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/c7mgEJ0RNIdbzfe...</td>\n",
       "      <td>湖北高沃科技有限公司</td>\n",
       "      <td>微信号：hbgw888888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/MqZ7ElPH8gksAnT...</td>\n",
       "      <td>快盈科技官方服务号</td>\n",
       "      <td>微信号：kuaiyingkeji</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/XTLeplxCIdH6zei...</td>\n",
       "      <td>稻草人网络科技</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz/DTx2JIuml7cx6TkTtKZ...</td>\n",
       "      <td>陕西畅通网络科技有限公司</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/rZia194gnpzrXc4...</td>\n",
       "      <td>利群信息科技</td>\n",
       "      <td>微信号：w7246314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/LeMRN463LG2npBu...</td>\n",
       "      <td>参美智创网络科技</td>\n",
       "      <td>微信号：shenmeizhichuag</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/rib1rickJU3RqPi...</td>\n",
       "      <td>数心网络科技</td>\n",
       "      <td>微信号：haifen92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/hVDY5yqv2bpSl3h...</td>\n",
       "      <td>鑫牛科技</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/Jp019cM4DCPpPT9...</td>\n",
       "      <td>加佳科技</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/MDYxDGe7BExOVe8...</td>\n",
       "      <td>深圳市脸付通智能科技有限公司</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/w6hDicZaibkkYDS...</td>\n",
       "      <td>重庆捷阳科技</td>\n",
       "      <td>微信号：chongqingjieyangkeji</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/9NDopxujvg9tQZp...</td>\n",
       "      <td>蚂蚁金服公开课</td>\n",
       "      <td>微信号：afbs_openclass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI...</td>\n",
       "      <td>青岛触角物联科技有限公司</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/uWNFVOic9YBW4Fw...</td>\n",
       "      <td>江西善金科技有限公司</td>\n",
       "      <td>微信号：JXSJ1888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/DLUX4bKiav4wqGG...</td>\n",
       "      <td>蚂蚁cashant</td>\n",
       "      <td>微信号：cashant</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/psqJ9K8An35Aicr...</td>\n",
       "      <td>若火科技</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI...</td>\n",
       "      <td>中原蚂蚁金服</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/OpUK52QUXE2Aqw2...</td>\n",
       "      <td>芭爷科技</td>\n",
       "      <td>微信号：BYKJ-HZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/ycUAn3ScPG5S9Bq...</td>\n",
       "      <td>济南蚂蚁金服</td>\n",
       "      <td>微信号：sd-bofu</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/AwbGS9iaoDMh2yy...</td>\n",
       "      <td>蚂蚁金服义乌站</td>\n",
       "      <td>微信号：zfb-yw</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/TIgmkU3YJL6icLh...</td>\n",
       "      <td>蚂蚁金服保险服务</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/agSJlCFecwn9B2n...</td>\n",
       "      <td>合肥蚂蚁金服</td>\n",
       "      <td>微信号：hfmyjf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/7teRkrDIhtadDa7...</td>\n",
       "      <td>蚂蚁小招</td>\n",
       "      <td>微信号：ANT-Fin-Recruitment</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/o5pOXFS9elJVBT9...</td>\n",
       "      <td>蚂蚁金服金华站</td>\n",
       "      <td>微信号：zhifubaojh</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/I8SfHxT94hVQ1sr...</td>\n",
       "      <td>蚂蚁研发效能</td>\n",
       "      <td>微信号：AntLinkE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/hUCbRoxybbdKSP1...</td>\n",
       "      <td>北京金蚂蚁</td>\n",
       "      <td>微信号：JMY_JF</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/vCicX1Y3qUn1Wz2...</td>\n",
       "      <td>蚂蚁云金服</td>\n",
       "      <td>微信号：mayiyunjinfu</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/muD0iaY26QREQa1...</td>\n",
       "      <td>广东蚂蚁旅游</td>\n",
       "      <td>微信号：gdmyly87563598</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/rFH9xa3hCiazRIx...</td>\n",
       "      <td>友宝一蚂蚁IT</td>\n",
       "      <td>微信号：XJRant</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/uibgoFmWoibzOKP...</td>\n",
       "      <td>安徽蚂蚁金服网络科技</td>\n",
       "      <td>微信号：anhuimyjf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/0YZHIqmVP7n9Gmn...</td>\n",
       "      <td>南京蚂蚁金服</td>\n",
       "      <td>微信号：njmyjf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/1f115uzuPIpPc4P...</td>\n",
       "      <td>蚂蚁旅游中山运营中心</td>\n",
       "      <td>微信号：zsmyly2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/dHt5aagRDicTgmT...</td>\n",
       "      <td>大连蚂蚁金服</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI...</td>\n",
       "      <td>科技蚂蚁</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/YtXzEj3ZA7rXVib...</td>\n",
       "      <td>蚂蚁好家政</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/ulbibatbfDPz4zM...</td>\n",
       "      <td>蚂蚁门户</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/b4lIQYQPAl7WHff...</td>\n",
       "      <td>芝麻信用服务号</td>\n",
       "      <td>微信号：zhimaxy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/OsQS7WgMFQOect8...</td>\n",
       "      <td>支付宝</td>\n",
       "      <td>微信号：Alipayvoice</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>http://mmbiz.qpic.cn/mmbiz_png/8pXrPXQMyiaN4JA...</td>\n",
       "      <td>蚂蚁达客</td>\n",
       "      <td>微信号：未设置</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                  img            nickname  \\\n",
       "0   http://mmbiz.qpic.cn/mmbiz_png/8zGb2W5DJWvF1ib...              蚂蚁金服科技   \n",
       "1   http://mmbiz.qpic.cn/mmbiz_png/rS76otFH2pNlicV...                蚂蚁金服   \n",
       "2   http://mmbiz.qpic.cn/mmbiz_png/ibouibdiaMA9Kyn...      山东蚂蚁金服网络科技有限公司   \n",
       "3   http://mmbiz.qpic.cn/mmbiz_png/cia3tMb8xpGJSuy...              蚂蚁金服花呗   \n",
       "4   http://mmbiz.qpic.cn/mmbiz_png/yUzZJ4Kn9SKeM7P...            蚂蚁金服客户中心   \n",
       "5   http://mmbiz.qpic.cn/mmbiz_png/njNOiayhTg0vmmu...          蚂蚁金服安全响应中心   \n",
       "6   http://mmbiz.qpic.cn/mmbiz_png/BjOkDkyzUic6MRB...              蚂蚁金服设计   \n",
       "7   http://mmbiz.qpic.cn/mmbiz_png/lb6ia71mvjV5VTC...            蚂蚁力量教育金服   \n",
       "8   http://mmbiz.qpic.cn/mmbiz_png/AswAlwaiaXrahCX...          刷脸支付科技招商总部   \n",
       "9   http://mmbiz.qpic.cn/mmbiz_png/8Lib8A2FWXhRy0C...            蚂蚁金服智慧网点   \n",
       "10  http://mmbiz.qpic.cn/mmbiz_png/XNsW9Nqm686vUkC...              蚂蚁科技评论   \n",
       "11  http://mmbiz.qpic.cn/mmbiz_png/7FPxWqp3TicK7vN...              蚂蚁金服传媒   \n",
       "12  http://mmbiz.qpic.cn/mmbiz_png/oeNiaK0ttF18Jxg...            竹琂网络科技商服   \n",
       "13  http://mmbiz.qpic.cn/mmbiz_png/7osPK5OqdibX3aw...           平江县蚂蚁部落乐园   \n",
       "14  http://mmbiz.qpic.cn/mmbiz_png/QVdwVySrAMqvLjO...  AttractPay 汇聚宝金融科技   \n",
       "15  http://mmbiz.qpic.cn/mmbiz_png/33LlDh3XEam0AYZ...               蚂蚁区块链   \n",
       "16  http://mmbiz.qpic.cn/mmbiz_png/c7mgEJ0RNIdbzfe...          湖北高沃科技有限公司   \n",
       "17  http://mmbiz.qpic.cn/mmbiz_png/MqZ7ElPH8gksAnT...           快盈科技官方服务号   \n",
       "18  http://mmbiz.qpic.cn/mmbiz_png/XTLeplxCIdH6zei...             稻草人网络科技   \n",
       "19  http://mmbiz.qpic.cn/mmbiz/DTx2JIuml7cx6TkTtKZ...        陕西畅通网络科技有限公司   \n",
       "20  http://mmbiz.qpic.cn/mmbiz_png/rZia194gnpzrXc4...              利群信息科技   \n",
       "21  http://mmbiz.qpic.cn/mmbiz_png/LeMRN463LG2npBu...            参美智创网络科技   \n",
       "22  http://mmbiz.qpic.cn/mmbiz_png/rib1rickJU3RqPi...              数心网络科技   \n",
       "23  http://mmbiz.qpic.cn/mmbiz_png/hVDY5yqv2bpSl3h...                鑫牛科技   \n",
       "24  http://mmbiz.qpic.cn/mmbiz_png/Jp019cM4DCPpPT9...                加佳科技   \n",
       "25  http://mmbiz.qpic.cn/mmbiz_png/MDYxDGe7BExOVe8...      深圳市脸付通智能科技有限公司   \n",
       "26  http://mmbiz.qpic.cn/mmbiz_png/w6hDicZaibkkYDS...              重庆捷阳科技   \n",
       "27  http://mmbiz.qpic.cn/mmbiz_png/9NDopxujvg9tQZp...             蚂蚁金服公开课   \n",
       "28  https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI...        青岛触角物联科技有限公司   \n",
       "29  http://mmbiz.qpic.cn/mmbiz_png/uWNFVOic9YBW4Fw...          江西善金科技有限公司   \n",
       "30  http://mmbiz.qpic.cn/mmbiz_png/DLUX4bKiav4wqGG...           蚂蚁cashant   \n",
       "31  http://mmbiz.qpic.cn/mmbiz_png/psqJ9K8An35Aicr...                若火科技   \n",
       "32  https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI...              中原蚂蚁金服   \n",
       "33  http://mmbiz.qpic.cn/mmbiz_png/OpUK52QUXE2Aqw2...                芭爷科技   \n",
       "34  http://mmbiz.qpic.cn/mmbiz_png/ycUAn3ScPG5S9Bq...              济南蚂蚁金服   \n",
       "35  http://mmbiz.qpic.cn/mmbiz_png/AwbGS9iaoDMh2yy...             蚂蚁金服义乌站   \n",
       "36  http://mmbiz.qpic.cn/mmbiz_png/TIgmkU3YJL6icLh...            蚂蚁金服保险服务   \n",
       "37  http://mmbiz.qpic.cn/mmbiz_png/agSJlCFecwn9B2n...              合肥蚂蚁金服   \n",
       "38  http://mmbiz.qpic.cn/mmbiz_png/7teRkrDIhtadDa7...                蚂蚁小招   \n",
       "39  http://mmbiz.qpic.cn/mmbiz_png/o5pOXFS9elJVBT9...             蚂蚁金服金华站   \n",
       "40  http://mmbiz.qpic.cn/mmbiz_png/I8SfHxT94hVQ1sr...              蚂蚁研发效能   \n",
       "41  http://mmbiz.qpic.cn/mmbiz_png/hUCbRoxybbdKSP1...               北京金蚂蚁   \n",
       "42  http://mmbiz.qpic.cn/mmbiz_png/vCicX1Y3qUn1Wz2...               蚂蚁云金服   \n",
       "43  http://mmbiz.qpic.cn/mmbiz_png/muD0iaY26QREQa1...              广东蚂蚁旅游   \n",
       "44  http://mmbiz.qpic.cn/mmbiz_png/rFH9xa3hCiazRIx...             友宝一蚂蚁IT   \n",
       "45  http://mmbiz.qpic.cn/mmbiz_png/uibgoFmWoibzOKP...          安徽蚂蚁金服网络科技   \n",
       "46  http://mmbiz.qpic.cn/mmbiz_png/0YZHIqmVP7n9Gmn...              南京蚂蚁金服   \n",
       "47  http://mmbiz.qpic.cn/mmbiz_png/1f115uzuPIpPc4P...          蚂蚁旅游中山运营中心   \n",
       "48  http://mmbiz.qpic.cn/mmbiz_png/dHt5aagRDicTgmT...              大连蚂蚁金服   \n",
       "49  https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI...                科技蚂蚁   \n",
       "50  http://mmbiz.qpic.cn/mmbiz_png/YtXzEj3ZA7rXVib...               蚂蚁好家政   \n",
       "51  http://mmbiz.qpic.cn/mmbiz_png/ulbibatbfDPz4zM...                蚂蚁门户   \n",
       "52  http://mmbiz.qpic.cn/mmbiz_png/b4lIQYQPAl7WHff...             芝麻信用服务号   \n",
       "53  http://mmbiz.qpic.cn/mmbiz_png/OsQS7WgMFQOect8...                 支付宝   \n",
       "54  http://mmbiz.qpic.cn/mmbiz_png/8pXrPXQMyiaN4JA...                蚂蚁达客   \n",
       "\n",
       "                      wechat  \n",
       "0            微信号：Ant-Techfin  \n",
       "1             微信号：mayi-jinfu  \n",
       "2             微信号：SDMYJF_FWH  \n",
       "3            微信号：mayi_huabei  \n",
       "4   微信号：AlipayCustomerCenter  \n",
       "5                    微信号：未设置  \n",
       "6                    微信号：未设置  \n",
       "7                    微信号：未设置  \n",
       "8              微信号：nshop8898  \n",
       "9             微信号：Smart_Site  \n",
       "10             微信号：afsreview  \n",
       "11                   微信号：未设置  \n",
       "12                   微信号：未设置  \n",
       "13                   微信号：未设置  \n",
       "14                   微信号：未设置  \n",
       "15                   微信号：未设置  \n",
       "16            微信号：hbgw888888  \n",
       "17          微信号：kuaiyingkeji  \n",
       "18                   微信号：未设置  \n",
       "19                   微信号：未设置  \n",
       "20              微信号：w7246314  \n",
       "21       微信号：shenmeizhichuag  \n",
       "22              微信号：haifen92  \n",
       "23                   微信号：未设置  \n",
       "24                   微信号：未设置  \n",
       "25                   微信号：未设置  \n",
       "26  微信号：chongqingjieyangkeji  \n",
       "27        微信号：afbs_openclass  \n",
       "28                   微信号：未设置  \n",
       "29              微信号：JXSJ1888  \n",
       "30               微信号：cashant  \n",
       "31                   微信号：未设置  \n",
       "32                   微信号：未设置  \n",
       "33               微信号：BYKJ-HZ  \n",
       "34               微信号：sd-bofu  \n",
       "35                微信号：zfb-yw  \n",
       "36                   微信号：未设置  \n",
       "37                微信号：hfmyjf  \n",
       "38   微信号：ANT-Fin-Recruitment  \n",
       "39            微信号：zhifubaojh  \n",
       "40              微信号：AntLinkE  \n",
       "41                微信号：JMY_JF  \n",
       "42          微信号：mayiyunjinfu  \n",
       "43        微信号：gdmyly87563598  \n",
       "44                微信号：XJRant  \n",
       "45             微信号：anhuimyjf  \n",
       "46                微信号：njmyjf  \n",
       "47            微信号：zsmyly2019  \n",
       "48                   微信号：未设置  \n",
       "49                   微信号：未设置  \n",
       "50                   微信号：未设置  \n",
       "51                   微信号：未设置  \n",
       "52               微信号：zhimaxy  \n",
       "53           微信号：Alipayvoice  \n",
       "54                   微信号：未设置  "
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_account"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<div class=\"weui-desktop-vm_primary\"><img src=\"http://mmbiz.qpic.cn/mmbiz_png/8zGb2W5DJWvF1ibic8Ff0hib2zM1PNggypmobkam18vP1Nh7kaBU77zrJ8WD9vd8nj4uicvXIFXu1Ek0ScZGia91Clw/0?wx_fmt=png\" class=\"inner_link_account_avatar\"> <strong class=\"inner_link_account_nickname\">蚂蚁金服科技</strong> <i class=\"inner_link_account_wechat\">微信号：Ant-Techfin</i></div> <div class=\"weui-desktop-vm_default inner_link_account_type\">订阅号</div>\n"
     ]
    }
   ],
   "source": [
    "element = driver.find_element_by_xpath('//ul[@class=\"inner_link_account_list\"]/li')\n",
    "main_content = element.get_attribute('innerHTML')\n",
    "print(main_content)\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n跳转_input = driver.find_element_by_xpath(\\'//span[@class=\"weui-desktop-pagination__form\"]/input\\')\\n跳转_a = driver.find_element_by_xpath(\\'//span[@class=\"weui-desktop-pagination__form\"]/a\\')\\n跳转_input.clear()\\n跳转_input.send_keys(2)\\n跳转_a.click()\\n'"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 跳转testing\n",
    "'''\n",
    "跳转_input = driver.find_element_by_xpath('//span[@class=\"weui-desktop-pagination__form\"]/input')\n",
    "跳转_a = driver.find_element_by_xpath('//span[@class=\"weui-desktop-pagination__form\"]/a')\n",
    "跳转_input.clear()\n",
    "跳转_input.send_keys(2)\n",
    "跳转_a.click()\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2]\n",
      "False\n"
     ]
    }
   ],
   "source": [
    "# 跳转上限\n",
    "l_e = driver.find_elements_by_xpath('//label[@class=\"weui-desktop-pagination__num\"]')\n",
    "l_e_int  = [int(x.text) for x in l_e] \n",
    "print (l_e_int)\n",
    "print (l_e_int[0]==l_e_int[-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2]\n"
     ]
    }
   ],
   "source": [
    "pages = list(range(l_e_int[0],l_e_int[-1]+1 ))\n",
    "#print(pages[0:2])\n",
    "pages = list(range(1,l_e_int[-1]+1 ))\n",
    "print(pages)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 循环/遍历"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "# global varialbes \n",
    "html_raw = dict()\n",
    "main_content =\"\"\n",
    "element = None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "def process_pages (pages):\n",
    "    for p in pages:\n",
    "        print (p,end='\\t')\n",
    "\n",
    "        跳转_input = driver.find_element_by_xpath('//span[@class=\"weui-desktop-pagination__form\"]/input')\n",
    "        跳转_a = driver.find_element_by_xpath('//span[@class=\"weui-desktop-pagination__form\"]/a')\n",
    "        跳转_input.clear()\n",
    "        跳转_input.send_keys(p)\n",
    "        跳转_a.click()\n",
    "\n",
    "        time.sleep(45+120*random())\n",
    "\n",
    "        element = driver.find_element_by_xpath('//div[@class=\"inner_link_article_list\"]')\n",
    "        main_content = element.get_attribute('innerHTML')\n",
    "        #print(main_content)\n",
    "        html_raw[p] = main_content"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\t2\t"
     ]
    }
   ],
   "source": [
    "process_pages(pages)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>html_snippets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>&lt;div&gt;&lt;label class=\"inner_link_article_item\"&gt;&lt;s...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>&lt;div&gt;&lt;label class=\"inner_link_article_item\"&gt;&lt;s...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                       html_snippets\n",
       "1  <div><label class=\"inner_link_article_item\"><s...\n",
       "2  <div><label class=\"inner_link_article_item\"><s..."
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame([html_raw]).T\n",
    "df.columns = [\"html_snippets\"]\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Stored 'html_raw' (dict)\n"
     ]
    }
   ],
   "source": [
    "%store html_raw\n",
    "import pickle \n",
    "filehandler = open(\"html_raw\", 'wb') \n",
    "pickle.dump(html_raw, filehandler)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>html_snippets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>&lt;div&gt;&lt;label class=\"inner_link_article_item\"&gt;&lt;s...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                       html_snippets\n",
       "2  <div><label class=\"inner_link_article_item\"><s..."
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_out = df[~df.duplicated()]\n",
    "print (len(df_out))\n",
    "df[df.duplicated()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[2]"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "try_again = list(df[df.duplicated()].index)\n",
    "print(try_again)\n",
    "try_again = try_again + list (set(pages).difference(set(df.index.values)))\n",
    "try_again"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 暂存档"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "filename = fn [\"output\"] [\"公众号_htm_snippets\"] \n",
    "df_out.to_csv(filename.format(公众号=公众号), sep=\"\\t\", encoding=\"utf8\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6,6,"
     ]
    }
   ],
   "source": [
    "def parse_html_snippets(_snippet_):\n",
    "    root = fromstring(_snippet_) \n",
    "    title = [x.text for x in root.xpath('//div[@class=\"inner_link_article_title\"]')]\n",
    "    create_time = [x.text for x in root.xpath('//div[@class=\"inner_link_article_date\"]')]\n",
    "    link = [x for x in root.xpath('//a/@href')]\n",
    "    _df_ = pd.DataFrame({\"title\":title, \"create_time\": create_time, \"link\":link})\n",
    "    return(_df_)\n",
    "    \n",
    "l_df = []\n",
    "for p in pages:\n",
    "    _df_ = parse_html_snippets(df.loc[p,\"html_snippets\"])\n",
    "    print (len(_df_), end=\",\")\n",
    "    l_df.append(_df_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>create_time</th>\n",
       "      <th>link</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>我是你的过客吗？</td>\n",
       "      <td>2016-11-20</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                               title create_time  \\\n",
       "0             第九届科技学术节之“i创杯”创意广告营销大赛  2017-12-03   \n",
       "1         第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "2             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "3             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "4   【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "5                           我是你的过客吗？  2016-11-20   \n",
       "6             第九届科技学术节之“i创杯”创意广告营销大赛  2017-12-03   \n",
       "7         第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "8             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "9             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "10  【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "\n",
       "                                                 link  \n",
       "0   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "1   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "2   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "3   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "4   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "5   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "6   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "7   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "8   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "9   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "10  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  "
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_url_out = pd.concat(l_df).reset_index(drop=True)\n",
    "df_url_out.loc[0:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>create_time</th>\n",
       "      <th>link</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>我是你的过客吗？</td>\n",
       "      <td>2016-11-20</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                               title create_time  \\\n",
       "7         第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "8             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "9             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "10  【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "11                          我是你的过客吗？  2016-11-20   \n",
       "\n",
       "                                                 link  \n",
       "7   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "8   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "9   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "10  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "11  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  "
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_url_out.tail(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>create_time</th>\n",
       "      <th>link</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>value</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>我是你的过客吗？</td>\n",
       "      <td>2016-11-20</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>我是你的过客吗？</td>\n",
       "      <td>2016-11-20</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  title create_time  \\\n",
       "value                                                 \n",
       "0                第九届科技学术节之“i创杯”创意广告营销大赛  2017-12-03   \n",
       "1            第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "2                第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "3                第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "4      【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "5                              我是你的过客吗？  2016-11-20   \n",
       "6                第九届科技学术节之“i创杯”创意广告营销大赛  2017-12-03   \n",
       "7            第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "8                第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "9                第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "10     【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "11                             我是你的过客吗？  2016-11-20   \n",
       "\n",
       "                                                    link  \n",
       "value                                                     \n",
       "0      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "1      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "2      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "3      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "4      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "5      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "6      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "7      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "8      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "9      http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "10     http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "11     http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  "
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# tagging 标记\n",
    "tagging_list = [\"\",\"马化腾\", \"腾讯\", \"微众银行\",\"腾讯复星\",\"腾讯风控\",\"腾讯支付\",\"WeChat\",\"We Remit\",\\\n",
    "                \"公益日\",\"红包\",\\\n",
    "                \"腾讯财付通\",\"鹅厂\",\"QQ钱包\",\"QQ红包\",\"QQ\",\\\n",
    "                \"只有一\",\"大咖\",\"听说\",\"图片\",\"照片\",\"小编\",\\\n",
    "                \"洗钱\", \"黑产\",\"被骗\",\"腾讯安全课\",\"诈骗\", \"炒股\",\"神秘兼职\",\"神秘组织\",\\\n",
    "                \"财付通\", \"品牌\",\\\n",
    "                \"收款\",\\\n",
    "                \"报告\",\\\n",
    "                \"银行卡\",\"理财\",\"选股\",\"发票\",\"基金\",\\\n",
    "                \"区块链\",\"金融云\",\"O2O\",\"农产品\",\"家乡\",\\\n",
    "                \"数据\", \"数据赋能\", \"智能\", \"数字孪生\", \"智慧大脑\",\\\n",
    "                \"出行\",\"乘车\",\"公交\",\"乘车码\", \"智慧地铁\",\\\n",
    "                \"高峰论坛\", \"智库\",\\\n",
    "                \"央行\",\"新规\", \\\n",
    "                \"微信\", \"微信支付\", \"跨境支付\", \"移动支付\",\"非银行支付\",\"电子支付\",\\\n",
    "                \"互联网金融\", \"金融科技\",\"互联网＋\",\"互联网+金融\",\"普惠金融\",\"虚拟银行\",\\\n",
    "                \"开放\",\"生态\",\"复杂\",\"互联网思维\",\"全球合作伙伴\",\\\n",
    "                \"联合国\", \"城市\", \"粤港澳大湾区\", \"平台\", \"可持续发展\", \"未来\", \"绿色\",\\\n",
    "                \"医护\",\"防护服\",\"小时\",\"武汉\",\"危机\",\"新冠肺炎\", \"疫\", \"疫情\", \"复工\",\"停课\",\"宅经济\",\\\n",
    "                \"基建\",\"新基建\"] #overwritable\n",
    "\n",
    "v_v_list = []\n",
    "\n",
    "for tag in tagging_list:\n",
    "    index_list = df_url_out [ df_url_out.title.str.contains(tag) ].index.tolist()\n",
    "    v_v_pairs = pd.DataFrame({tag:index_list}).melt().set_index(\"value\")\n",
    "    v_v_list.append(v_v_pairs)\n",
    "\n",
    "df_cat = v_v_list[0]\n",
    "for d in v_v_list:\n",
    "    df_cat.update(d)\n",
    "    \n",
    "# 尚未标记内容\n",
    "df_url_out.loc [ df_cat.query('variable==\"\"').index ]"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "df_url_out.loc[53].link"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>create_time</th>\n",
       "      <th>link</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>我是你的过客吗？</td>\n",
       "      <td>2016-11-20</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                               title create_time  \\\n",
       "6             第九届科技学术节之“i创杯”创意广告营销大赛  2017-12-03   \n",
       "7         第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "8             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "9             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "10  【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "11                          我是你的过客吗？  2016-11-20   \n",
       "\n",
       "                                                 link  \n",
       "6   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "7   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "8   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "9   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "10  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "11  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  "
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_url_out[df_url_out.duplicated()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>create_time</th>\n",
       "      <th>link</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>我是你的过客吗？</td>\n",
       "      <td>2016-11-20</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              title create_time  \\\n",
       "0            第九届科技学术节之“i创杯”创意广告营销大赛  2017-12-03   \n",
       "1        第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "2            第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "3            第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "4  【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "5                          我是你的过客吗？  2016-11-20   \n",
       "\n",
       "                                                link  \n",
       "0  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "1  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "2  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "3  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "4  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  \n",
       "5  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...  "
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_url_out[~df_url_out.duplicated()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>create_time</th>\n",
       "      <th>link</th>\n",
       "      <th>variable</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>我是你的过客吗？</td>\n",
       "      <td>2016-11-20</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜</td>\n",
       "      <td>2017-12-03</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-11</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>第九届科技学术节之“i创杯”创意广告营销大赛</td>\n",
       "      <td>2017-11-08</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行</td>\n",
       "      <td>2017-09-24</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>我是你的过客吗？</td>\n",
       "      <td>2016-11-20</td>\n",
       "      <td>http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...</td>\n",
       "      <td>无法分类</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                               title create_time  \\\n",
       "0             第九届科技学术节之“i创杯”创意广告营销大赛  2017-12-03   \n",
       "1         第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "2             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "3             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "4   【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "5                           我是你的过客吗？  2016-11-20   \n",
       "6             第九届科技学术节之“i创杯”创意广告营销大赛  2017-12-03   \n",
       "7         第九届科技学术节之“i创杯”创意广告营销大赛决赛之夜  2017-12-03   \n",
       "8             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-11   \n",
       "9             第九届科技学术节之“i创杯”创意广告营销大赛  2017-11-08   \n",
       "10  【文学与传媒学院第十期征文比赛之创意写作比赛】创意无限，青春随行  2017-09-24   \n",
       "11                          我是你的过客吗？  2016-11-20   \n",
       "\n",
       "                                                 link variable  \n",
       "0   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "1   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "2   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "3   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "4   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "5   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "6   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "7   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "8   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "9   http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "10  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  \n",
       "11  http://mp.weixin.qq.com/s?__biz=MzIxODY2NjAxNw...     无法分类  "
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_o = df_url_out.join(df_cat).replace(\"\", np.nan).fillna(\"无法分类\")\n",
    "df_o"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>create_time</th>\n",
       "      <th>link</th>\n",
       "      <th>variable</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [title, create_time, link, variable]\n",
       "Index: []"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_o[df_o.title.str.contains(\"腾讯\")]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>variable</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>无法分类</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          title\n",
       "variable       \n",
       "无法分类         12"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_stats = df_o.groupby(by=\"variable\").agg({\"title\":\"count\"}).sort_values(by=\"title\", ascending=False)\n",
    "df_stats"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 输出"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_account.columns.name = \"rel_accounts\"\n",
    "df_o.columns.name = \"url_cat\"\n",
    "df_stats.columns.name = \"stats\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [],
   "source": [
    "_df_.columns.name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Get the xlsxwriter workbook and worksheet objects.  \n",
    "with pd.ExcelWriter(fn[\"output\"][\"公众号_xlsx\"].format(公众号=公众号)) as writer:\n",
    "    workbook  = writer.book\n",
    "\n",
    "    for _df_ in [df_account, df_o, df_stats]:\n",
    "        _df_.to_excel(writer, sheet_name = _df_.columns.name)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
